package com.chao.wind3j.base.config.commonConfig;

import com.chao.wind3j.base.config.commonConfig.requestLogConfig.requestInterceptor.LogInterceptor;
import com.chao.wind3j.service.Wind3RequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

  @Autowired
  private CommonProperties commonProperties;

  @Autowired
  private Wind3RequestService wind3RequestService;

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(new LogInterceptor(this.commonProperties, this.wind3RequestService)).addPathPatterns("/**");
  }

}
